<template>
  <div class="xiang">
    <div class="shang">
      <span class="iconfont icon-fanhui" @click="tuichu()"></span>
      <p>{{this.$store.state.xiang.name}}详情</p>
      <div class="tou">
        <span class="iconfont icon-dian"></span>
        <div class="zhongjian"></div>
        <span class="iconfont icon-shuangyuanquan"></span>
      </div>
    </div>
    <div class="zhong">
      <div :class="xflag?'fangda':'fangdas'">
        <img :src="this.$store.state.xiang.src" alt />
      </div>
    </div>
    <div class="xia">
      <div class="xiasshang">
        <h1 class="price">￥{{this.$store.state.xiang.price}}.00</h1>
        <h1 class="chiguo">
          {{this.$store.state.xiang.name}}
          <p>{{this.$store.state.xiang.chiguo}}人吃过</p>
        </h1>
        <p>单商品起送：{{this.$store.state.xiang.qisong}}份 剩余{{this.$store.state.xiang.shenyu}}份</p>
      </div>
      <p class="tejia">
        <span>{{this.$store.state.xiang.candian}}</span>
        {{this.$store.state.xiang.canyang}}
      </p>
      <p class="jieshao">{{this.$store.state.xiang.jieshao}}</p>
      <ul class="baozhang">
        <li>
          <span class="iconfont icon-dunpai"></span>
          <p>安全保障</p>
        </li>
        <li>
          <span class="iconfont icon-dunpai"></span>
          <p>科学合理</p>
        </li>
        <li>
          <span class="iconfont icon-dunpai"></span>
          <p>食品追述</p>
        </li>
      </ul>
    </div>
    <div class="jsyyfw">
      <ul>
        <li :class="this.flagg?'shao':'shaos'" @click="gaoliang('shipu')">食谱介绍</li>
        <li :class="this.flagh?'shao':'shaos'" @click="gaoliang('yingyang')">营养价值</li>
        <li :class="this.flagk?'shao':'shaos'" @click="gaoliang('fuwu')">服务介绍</li>
      </ul>
      <p>分享</p>
    </div>
    <div class="caipinshipu" v-if="this.flagg">
        <h1>成分介绍</h1>
        <p>{{this.$store.state.xiang.chengfeng}}</p>
        <h1>制作方法</h1>
        <p>{{this.$store.state.xiang.zhizuo}}</p>
    </div>
    <div class="caipinyingyang" v-if="this.flagh">营养价值</div>
    <div class="caipinfuwu" v-if="this.flagk">服务介绍</div>
  </div>
</template>

<script>

export default {
  name: "xiang",
  data() {
    return {
      xflag: false,
      active: 0,
      tive: 1,
      flagg: true,
      flagh: false,
      flagk: false
    };
  },
  methods: {
    gaoliang(e) {
        if(e==="shipu"){
            this.flagg=true
            this.flagh=false
            this.flagk=false
        }else if(e==="yingyang"){
            this.flagg=false
            this.flagh=true
            this.flagk=false
        }else if(e==="fuwu"){
            this.flagg=false
            this.flagh=false
            this.flagk=true
        }
    },
    tuichu() {
      this.$emit("tuichus");
    }
  },
  mounted() {
    setTimeout(() => {
      this.xflag = true;
    }, 20);
  }
};
</script>

<style scoped>
@import url("../../../../../../assets/fonts2/iconfont.css");
.xiang {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #fff;
  z-index: 4;
  overflow-y: auto;
}
.ding {
  width: 100%;
  height: 30px;
}
.ding img {
  width: 100%;
  height: 30px;
}
.shang {
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shang > span {
  margin-left: 10px;
}
.tou {
  width: 100px;
  height: 30px;
  background: rgba(145, 145, 145);
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-right: 10px;
}
.zhongjian {
  width: 1px;
  height: 60%;
  background: #fff;
}
.zhong {
  width: 94%;
  height: 200px;
  margin: 0 auto;
}
.zhong img {
  width: 100%;
  height: 100%;
}
.fangda {
  width: 100%;
  height: 100%;
  transform: translate(0, 0) scale(1);
  transition: all 1000ms;
}
.fangdas {
  width: 100%;
  height: 100%;
  transform: translate(0, -200px) scale(0.2);
  transition: all 1000ms;
}
.xia {
  width: 94%;
  height: 250px;
  margin: 0 auto;
}
.xiasshang {
  width: 100%;
  height: 80px;
}
.xiasshang .price {
  color: red;
}
.xiasshang h1 {
  font-size: 20px;
  line-height: 25px;
}
.xiasshang .chiguo {
  display: flex;
  justify-content: space-between;
}
.xiasshang .chiguo p {
  display: inline-block;
  font-size: 12px;
  color: rgba(126, 126, 126);
}
.xia > p > span {
  display: inline-block;
  line-height: 18px;
  padding: 0 5px;
  font-size: 12px;
  border: 1px solid red;
  color: red;
  margin-right: 5px;
}
.xia > p {
  line-height: 25px;
}
.xia .tejia {
  font-size: 15px;
}
.xia .jieshao {
  font-size: 12px;
  text-indent: 2em;
  color: rgba(126, 126, 126);
}
.xia .baozhang {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
}
.xia .baozhang li {
  margin-right: 20px;
}
.xia .baozhang li p {
  font-size: 15px;
  display: inline-block;
  color: red;
  margin-left: 5px;
}
.jsyyfw {
  width: 94%;
  height: 30px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.jsyyfw ul {
  height: 30px;
  display: flex;
  align-items: center;
}
.jsyyfw p {
  line-height: 30px;
  color: rgba(126, 126, 126);
  font-size: 12px;
}
.jsyyfw ul li {
  margin-right: 20px;
  font-size: 15px;
}
.shaos {
  color: rgba(126, 126, 126);
}
.shao {
  line-height: 28px;
  color: #000;
  font-weight: 600;
  border-bottom: 2px solid blue;
}
.caipinshipu{
  width: 94%;
  height: calc(100% - 550px);
  margin: 0 auto;
}
.caipinshipu h1{
  font-size: 20px;
}
.caipinshipu p{
  font-size: 15px;
}
.caipinyingyang{
  width: 94%;
  height: calc(100% - 550px);
  margin: 0 auto;
}
.caipinfuwu{
  width: 94%;
  height: calc(100% - 550px);
  margin: 0 auto;
}
.yuyue {
  width: 100%;
  height: 40px;
  position: fixed;
  bottom: 100px;
  left: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.yuyue button {
  width: 100px;
  height: 40px;
  border: none;
  outline: none;
  background: rgba(254, 164, 9);
  border-radius: 20px;
}
</style>